package com.example.helloworld;

public class MaximumTest {
    public static <T extends Comparable<T>> T maximum(T x, T y, T z) {
        T max = x;
        if (y.compareTo(max) > 0) {
            max = y;
        }
        if (z.compareTo(max) > 0) {
            max = z;
        }
        return max;
    }

    public static void main(String[] args) {
        System.out.printf("%d, %d 和 %d 的最大值是 %d\n", 3, 4, 5, maximum(3, 4, 5));
        System.out.printf("%.1f, %.1f 和 %.1f 的最大值是 %.1f\n", 4.4, 5.5, 3.3, maximum(4.4, 5.5, 3.3));
        System.out.printf("%s, %s 和 %s 的最大值是 %s\n", "apple", "banana", "orange", maximum("apple", "banana", "orange"));
    }
}
